import { type PropType, type ExtractPropTypes } from 'vue';

export type TModelValue = string | string[];

export interface IOptionProps {
  value: string;
  label: string;
}

export interface IReceiveConditionData {
  [key: string]: string;
}

export const conditionSelectProps = Object.assign({}, {
  modelValue: {
    type: [String, Array] as PropType<TModelValue>,
    default: '',
  },
  title: {
    type: String,
    default: '',
  },
  boldTitle: {
    type: Boolean,
    default: true,
  },
  options: {
    type: Array as PropType<IReceiveConditionData[]>,
    default: () => [],
    required: true,
  },
  keyProps: {
    type: Object as PropType<IOptionProps>,
    default: () => ({
      value: 'value',
      label: 'label',
    }),
  },
  // 多选模式
  multiple: {
    type: Boolean,
    default: false,
  },
  // 多选互斥
  incompat: {
    type: String,
  },
  // 可清除模式
  clearable: {
    type: Boolean,
    default: false,
  },
} as const);

export type ConditionSelectProps = ExtractPropTypes<typeof conditionSelectProps>;
